#include <QPainter>
#include "common.h"
#include "previewframe.h"

PreviewFrame::PreviewFrame(QWidget *parent) :
    QWidget(parent)
{
//    setObjectName("myFrame");
    m_background.load(TMP_DIR+"previewframe.png");
    this->setMinimumSize(325, 330);
    this->setMaximumWidth(325);
/*
    m_videoScreen = new QLabel(this);
    m_videoScreen->setObjectName("mylabel");
    m_videoScreen->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
 //   m_videoScreen->setAutoFillBackground(true);
    QString styles;
    QString strImg = "screen.png";
    styles = "QLabel{border-image:url("+TMP_DIR+strImg+");}";
    m_videoScreen->setStyleSheet(styles);


    QRect rc;
    rc.setLeft(2);
    rc.setTop(30);
    rc.setWidth(320);
    rc.setHeight(235);
    m_videoScreen->setFrameRect(rc);
//    m_videoScreen->resize(320, 250);
    m_videoScreen->setGeometry(rc);
    m_videoScreen->show();
 //   m_videoScreen->setStyleSheet();
*/
}

void PreviewFrame::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    painter.drawPixmap(0,0,width(),height(),m_background);
}
